{include file="public/header,public/nav,public/fixbar" title="搜索页-<?php echo request()->pc_info['seo_title']?>"/}
<div class="layui-body">
    <div class="layui-container">
        <div class="layui-main min-height-80vh">
            <div class="layui-row">
                <form class="layui-form" autocomplete="off" action="/search/result">
                    <div class="layui-col-xs12 layui-col-md6 search-box">
                        <div>
                            <input name="keywords" value="" class="layui-input" placeholder="输入商品关键词" lay-verify="required" lay-verType="tips" lay-reqtext="请输入有效商品关键词">
                            <button style="display: inline-block;position: absolute;right: 0px;margin-top: -50px;" type="button" class="layui-btn layui-bg-success" id="searchBtn" lay-submit lay-filter="searchBtn"><i class="layui-icon layui-icon-search"></i> 搜索</button>
                        </div>
                        <div class="layui-form-mid layui-text-em">搜索课程、题库、实物、考试、直播课</div>
                    </div>
                </form>
            </div>

            <div class="layui-row">
                <div class="layui-font-16 margin-bottom-15 font-weight-bold">
                    <i class="layui-icon layui-icon-fire layui-font-16 padding-right-5 layui-font-red"></i>
                    推荐商品
                </div>
                <div class="layui-col-space25">
                    {foreach $list as $v}
                        <div class="layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg4">
                            <a href="{$v.href}">
                                <div class="layui-card product-item">
                                    <div class="layui-card-body">
                                        <div class="item">
                                            {if $v.product_type == 1}
                                            <img src="{$v.head_imgs}" class="user-goods-img">
                                            {elseif $v.product_type == 10}
                                            <div class="justify-content-center">
                                                <img style="background-color: {$v.background_color};margin-right: 0px;" src="{$v.head_imgs}" class="user-goods-img">
                                                <span class="exam-sub-title">{$v.sub_title}</span>
                                            </div>
                                            {else}
                                            <img src="{$v.head_imgs}" class="user-course-img">
                                            {/if}
                                            <div class="detail">
                                                <div class="product-title layui-ellipss">
                                                    <span class="item-title-label">{$v.product_type_text}</span>{$v.name}
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-card-footer">
                                        <p class="text">已售 <b>{$v.virtual_sales+$v.real_sales}</b></p>
                                        {if $v.sale_price == 0}
                                        <p class="product-price layui-font-16">免费</p>
                                        {else}
                                        <p class="product-price layui-font-16"><span class="symbol">￥</span>{$v.sale_price}</p>
                                        {/if}
                                    </div>
                                </div>
                            </a>
                        </div>
                    {/foreach}
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer"/}
<script type="text/javascript">
    layui.use(['flow','form'], function(){
        var $ = layui.jquery, flow = layui.flow, form = layui.form;

        form.on('submit(searchBtn)', function(data){
            
            var loading = layer.load();
            var href = '/search/result?keywords='+data.field.keywords;

            location.href = href;
            layer.close(loading);
            return false;
        });
    });
</script>